$(function () {
    show(1);
    $("#firstpage").click(function () {
        var currentpage = parseInt($("#currentpage").html());
        if (currentpage !== 1) {
            show(1);
            location.reload()
        }
    })
    $("#prepage").click(function () {
        var currentpage = parseInt($("#currentpage").html());
        if (currentpage > 1) {
            show(currentpage - 1);
            location.reload()
        }
    })
    $("#nextpage").click(function () {
        var currentpage = parseInt($("#currentpage").html());
        var totalpage = parseInt($("#totalpage").html());
        if (currentpage < totalpage) {
            show(currentpage + 1);
            location.reload()
        }
    })
    $("#lastpage").click(function () {
        var currentpage = parseInt($("#currentpage").html());
        var totalpage = parseInt($("#totalpage").html());
        if (currentpage !== totalpage) {
            show(totalpage);
            location.reload()
        }
    })
})

function show(cpage) {
    $.ajax({
        url: "/commentPage",
        type: "POST",
        data: {
            currentPage: cpage
        },
        dataType: "json",
        success: function (data) {

        }
    })
}

